<!DOCTYPE html>
<html>
<head>
<title>后台登录xxx</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
    <script src="//lib.sinaapp.com/js/jquery/1.12.4/jquery-1.12.4.min.js"></script> 
    <script src="/static/layer/layer/layer.js"></script>

</head>
<body style="background: #fff">
    <div class="container p-5 my-5 bg-dark text-white" style="max-width: 600px;"  >
    <h2>{$sys_name}</h2>
    <form>
      <div class="mb-3 mt-3">
        <label for="account" class="form-label">Account:</label>
        <input type="text" class="form-control" id="account" placeholder="Enter Account" name="account">
      </div>
      <div class="mb-3">
        <label for="pwd" class="form-label">Password:</label>
        <input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd">
      </div>
      <div class="form-check mb-3">
        <label class="form-check-label">
          <!--<input class="form-check-input" type="checkbox" name="remember"> Remember me-->
        </label>
      </div>
      <button  type="button" class="btn btn-primary" onclick="dologin()">Submit</button>
      <button  type="reset" class="btn btn-info">Reset</button>
    </form>
    </div>

<script type="text/javascript">

        $('input').keydown(function(e){
            if(e.keyCode == 13){
                dologin();
            }
        });  
        function dologin(){
            var account = $.trim($('#account').val());
            var pwd = $.trim($('#pwd').val());
            if(account == ''){
                layer.alert('Please input Account!');
                return;
            }
            if(pwd == ''){
                layer.alert('Please input Password!');
                return;
            }
            $.post('/index.php/login/index',{'account':account,'pwd':pwd},function(res){
                if(res.code>0){
                    layer.alert(res.msg);
                }else{
                    layer.msg(res.msg);
                    setTimeout(function(){window.location.href = '/index.php/admin'},1000);
                }
            },'json');
        }    

</script>


</body>
</html>
